package com.offcn.service.impl;

import com.offcn.entity.Book;
import com.offcn.mapper.BookMapper;
import com.offcn.service.BookService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.List;

@Service
public class BookServiceImpl implements BookService {
    @Resource
    private BookMapper bookMapper;
    List<Book> list = new ArrayList<>();
    @Override
    public int add(Book book) {
       bookMapper.add(book);
       return 1;
    }

    @Override
    public int delete(int id) {
        bookMapper.delete(id);
        return 1;
    }

    @Override
    public List<Book> select() {
        return bookMapper.select();
    }

    @Override
    public Book selectOne(int id) {
        Book book = bookMapper.selectOne(id);
        return book;
    }

    @Override
    public int update(Book book) {
       bookMapper.update(book);
        return 1;
    }
}
